package com.smy.jkds.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import javax.validation.constraints.NotNull;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author zoum
 * @since 2021-10-31
 */
@Data
  @TableName("cts.jkds_user")
public class JkdsUser implements Serializable {

    private static final long serialVersionUID = 1L;

      //用户ID
        @TableId("id")
      private String id;

        @NotNull
      //手机号（可用于登录）
      @TableField("mobile")
    private String mobile;

      //账户号
      @TableField("account_no")
    private String accountNo;

      //账户密码
    @NotNull
      @TableField("password")
    private String password;

      //用户姓名
      @TableField("name")
    private String name;

      //加密：盐
      @TableField("salt")
    private String salt;

      //身份证号
      @TableField("id_card")
    private String idCard;

      //邮箱号
      @TableField("email")
    private String email;

      //年龄
      @TableField("age")
    private Integer age;

      //性别 0=女 1=男
      @TableField("gender")
    private Integer gender;

      //地址
      @TableField("address")
    private String address;

      //会员标志 1=普通用户 2 白银会员 3黄黄金 4 砖石会员 
      @TableField("vip")
    private Integer vip;

      //会员生效日期
      @TableField("vip_start_date")
    private LocalDateTime vipStartDate;

      //会员失效日期
      @TableField("vip_end_date")
    private LocalDateTime vipEndDate;

      //会员来源1=web 2=app 3=third
      @TableField("vip_source")
    private Integer vipSource;

      //创建时间
      @TableField("create_time")
    private LocalDateTime createTime;

      //更新时间
      @TableField("update_time")
    private LocalDateTime updateTime;

public QueryWrapper<JkdsUser> getQueryWrapper(){
        QueryWrapper<JkdsUser> queryWrapper = new QueryWrapper<>();
    if(id != null){
        queryWrapper.eq(ColumnEnum.id.name(),id);
    }
    if(mobile != null){
        queryWrapper.eq(ColumnEnum.mobile.name(),mobile);
    }
    if(accountNo != null){
        queryWrapper.eq(ColumnEnum.account_no.name(),accountNo);
    }
    if(password != null){
        queryWrapper.eq(ColumnEnum.password.name(),password);
    }
    if(name != null){
        queryWrapper.eq(ColumnEnum.name.name(),name);
    }
    if(salt != null){
        queryWrapper.eq(ColumnEnum.salt.name(),salt);
    }
    if(idCard != null){
        queryWrapper.eq(ColumnEnum.id_card.name(),idCard);
    }
    if(email != null){
        queryWrapper.eq(ColumnEnum.email.name(),email);
    }
    if(age != null){
        queryWrapper.eq(ColumnEnum.age.name(),age);
    }
    if(gender != null){
        queryWrapper.eq(ColumnEnum.gender.name(),gender);
    }
    if(address != null){
        queryWrapper.eq(ColumnEnum.address.name(),address);
    }
    if(vip != null){
        queryWrapper.eq(ColumnEnum.vip.name(),vip);
    }
    if(vipStartDate != null){
        queryWrapper.eq(ColumnEnum.vip_start_date.name(),vipStartDate);
    }
    if(vipEndDate != null){
        queryWrapper.eq(ColumnEnum.vip_end_date.name(),vipEndDate);
    }
    if(vipSource != null){
        queryWrapper.eq(ColumnEnum.vip_source.name(),vipSource);
    }
    if(createTime != null){
        queryWrapper.eq(ColumnEnum.create_time.name(),createTime);
    }
    if(updateTime != null){
        queryWrapper.eq(ColumnEnum.update_time.name(),updateTime);
    }
        return queryWrapper;
}


public enum ColumnEnum {
        id,
        mobile,
        account_no,
        password,
        name,
        salt,
        id_card,
        email,
        age,
        gender,
        address,
        vip,
        vip_start_date,
        vip_end_date,
        vip_source,
        create_time,
        update_time,
      ;
}
}
